package com.czk.springcloud.sercice;

import com.czk.springcloud.entity.CommonResult;
import com.czk.springcloud.entity.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Author:ChenZhangKun
 * @Date: 2020/12/18 14:15
 */
@Service
// 找哪个微服务
//@FeignClient(value = "CLOUD-env-SERVICE") // 模拟注册bean时替换env
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface PaymentFeignService {
    /**
     * 读
     *
     * @param id
     * @return
     */
    /*@GetMapping("/payment/select/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);
*/

    /**
     * 模拟feign超时接口
     *
     * @return
     */
/*
    @GetMapping("/payment/feign/timeout")
    String paymentFeignTimeout();
*/

    /**
     * 模拟动态替换
     *
     * @param id
     * @return
     */
    @GetMapping("//CLOUD-PAYMENT-SERVICE/$env/select/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    /**
     * 模拟通过factorybean改变路由
     *
     * @return
     */
    @GetMapping("/payment/feign/timeout")
    String paymentFeignTimeout();
}
